// 导入
import { saveAs as FileSaver } from "file-saver";

export function downLoadFileFn(url, name) {
  const oReq = new XMLHttpRequest();
  oReq.open("GET", url, true);
  oReq.responseType = "blob";
  oReq.onload = function () {
    const file = new Blob([oReq.response], {
      type: "blob",
    });
    FileSaver.saveAs(file, name); // fileName为文件名
  };
  oReq.send();
};
